public class Narcissistic {
    //求出0-999之间的所有水仙花数
    public static void main(String[] args) {
        int i = 0;
        for (i = 0; i < 1000; i++) {
            int count = 0;
            int sum = 0;
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            tmp = i;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10, count);//数字的几次方
                tmp /= 10;
            }
            if (sum == i) {
                System.out.println(i);
            }
        }
    }
}
